import request from '@u/request'
import { HttpMethod } from '@u/http'

// 查询列表
export function listProductCategory(query) {
  return request({
    url: '/beauty/productCategory/list',
    method: HttpMethod.GET,
    params: query
  })
}

// 查询
export function getProductCategory(id) {
  return request({
    url: '/beauty/productCategory/' + id,
    method: HttpMethod.GET
  })
}

// 新增
export function addProductCategory(data) {
  return request({
    url: '/beauty/productCategory',
    method: HttpMethod.POST,
    data: data
  })
}

// 修改
export function updateProductCategory(data) {
  return request({
    url: '/beauty/productCategory',
    method: HttpMethod.PUT,
    data: data
  })
}

// 删除
export function delProductCategory(id) {
  return request({
    url: '/beauty/productCategory/' + id,
    method: HttpMethod.DELETE
  })
}

// 查询列表（排除节点）
export function listProductCategoryExcludeChild(deptId) {
  return request({
    url: '/beauty/productCategory/list/exclude/' + deptId,
    method: HttpMethod.GET
  })
}

// 下拉列表数据
export function getProductCategoryOptionSelect() {
  return request({
    url: '/beauty/productCategory/getOptionSelect',
    method: HttpMethod.GET
  })
}

// 根据品牌id获取商品分类id集合
export function getProductCategoriesByBrandId(brandId) {
  return request({
    url: `/beauty/productCategory/getProductCategories/${brandId}`,
    method: HttpMethod.GET
  })
}

// 查询所有二级商品分类
export function getSecondLevelProductCategories() {
  return request({
    url: `/beauty/productCategory/getSecondLevelProductCategories`,
    method: HttpMethod.GET
  })
}
